package cn.itsource.hrm.feign;

import cn.itsource.hrm.domain.LoginUser;
import cn.itsource.hrm.util.AjaxResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * feign熔断的写法。
 */
@Component //交给Spring管理
public class LoginUserClientFellback implements FallbackFactory<ILoginUserClient>{

    @Override
    public ILoginUserClient create(Throwable throwable) {

        return new ILoginUserClient() {
            @Override
            public AjaxResult entering(LoginUser loginUser) {
                return AjaxResult.me().setSuccess(false).setMessage("店铺入驻系统繁忙");
            }
        };
    }
}
